import torch
import torch.nn as nn
import torch.nn.functional as F


x = torch.LongTensor([
    [0,1,2],
    [3,4,5]
])
embedds = nn.Embedding(6,5)
ed = embedds(x)
# print(ed.shape)


# 测试资料
word_to_ix = {"hello": 0, "world": 1}
# 词汇表(vocabulary)含2个单字, 转换为5维的向量
embeds = nn.Embedding(2, 5)
# 测试 hello
lookup_tensor = torch.LongTensor([1])
hello_embed = embeds(lookup_tensor)
print(hello_embed)